import 'package:app/config/ServiceUlr.dart';
import 'package:app/service/serviee_method.dart';
import 'package:flutter/material.dart';
import 'package:html/parser.dart' show parse;

class QueryModel with ChangeNotifier {

  List<List> data=[];
  List itemList=[];
  Future getHttpData() async{
    Map<String,String> map=Map();
    map["buildPlan"]="";
    map["department"]="";
    map["eventReason"]="";
    map["eventType"]="";
    map["jssj"]="";
    map["kssj"]="";
    map["organization"]="";
    map["pipeRadius"]="";
    map["projectName"]="";
    map["projectStatus"]="";
    map["companyId"]="402880185889ef6e015889f8c51e0000";
    map["userId"]="8a2a2a295c1ec767015c2ddd9d1e0001";

    await getHttpPost(servicePath["query"], map).then((value){
      getListData(value);
    });
    notifyListeners();
  }

  void getListData(value) {
     var document = parse(value);
        var body= document.getElementsByTagName("tr");
      itemList.clear();
      data.clear();
      for(int i=1;i<body.length;i++){
         var list=body[i].getElementsByTagName("td");
      for(int j=1;j<list.length;j++){
       String name= list[j].outerHtml.substring(4,list[j].outerHtml.length-5).trim();
        itemList.add(name);
      }
      data.add(itemList);
      }
  }

}